﻿using Pomelo.EntityFrameworkCore.MySql.Infrastructure;
using Pomelo.EntityFrameworkCore.MySql.Storage;

namespace K9Nano.MySql
{
    public sealed class MySqlOption
    {
        public string ConnectionString { get; set; }
        
        public string Version { get; set; }

        public string SharedScheme { get; set; }

        public ServerType ServerType { get; set; } = ServerType.MariaDb;

        public ServerVersion ServerVersion => new ServerVersion(System.Version.Parse(Version), ServerType.MariaDb);
        
        public void CloneFrom(MySqlOption option)
        {
            ConnectionString = option.ConnectionString;
            Version = option.Version;
            ServerType = option.ServerType;
            SharedScheme = option.SharedScheme;
        }
    }
}
